using System;
using Abp.Extensions;
using Abp.Runtime.Validation;
using L._52ABP.Application.Dtos;

namespace Yozeev.Auditing.Dtos
{
    /// <summary>
    ///     登录日志接收DTO
    /// </summary>
    public class GetLoginLogsInput : PagedAndSortedInputDto, IShouldNormalize
    {
        /// <summary>
        ///     开始时间
        /// </summary>
        public DateTime? StartDate { get; set; }

        /// <summary>
        ///     结束时间
        /// </summary>
        public DateTime? EndDate { get; set; }

        /// <summary>
        ///     登录用户名或邮箱
        /// </summary>
        public string UserName { get; set; }

        /// <summary>
        /// 登录端
        /// </summary>
        public string SourceName { get; set; }
        /// <summary>
        /// 登录端编码
        /// </summary>
        public string SourceCode { get; set; }
        /// <summary>
        /// IP地址
        /// </summary>
        public string ClientIpAddress { get; set; }

        /// <summary>
        ///     是否包含异常
        /// </summary>
        public bool? HasException { get; set; }

        public void Normalize()
        {
            if (Sorting.IsNullOrWhiteSpace()) Sorting = "ExecutionTime DESC";

        }
    }
}